from base.base import Base
from appium import webdriver
from time import sleep
import logging
from selenium.webdriver.common.by import By
class Sousuopage(Base):
    dianjiguanzhuanniu=(By.ID,'com.kongfz.app:id/lav_2')
    dianjisousuokuang=(By.XPATH,'/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.RelativeLayout/android.widget.FrameLayout/android.widget.FrameLayout[2]/android.view.ViewGroup/android.view.ViewGroup/android.widget.LinearLayout/android.widget.LinearLayout/android.widget.LinearLayout')
    dianjikuang='new UiSelector().text("动态 书友 话题")'
    sousuoannniu = (By.XPATH,'//android.widget.TextView[@text="搜索"]')
    shuyou = (By.XPATH,'/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.view.ViewGroup/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.LinearLayout[2]/android.widget.TextView[2]')
    dy =(By.XPATH,'/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.view.ViewGroup/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.LinearLayout[2]/android.widget.TextView[1]')
    def sousuogongneng(self,cencet):
        logging.info("开始测试执行")
        self.loc_ele(self.dianjiguanzhuanniu).click()
        sleep(2)
        self.loc_ele(self.dianjisousuokuang).click()
        sleep(2)
        logging.info("输入搜索内容")
        self.loc_ui_ele(self.dianjikuang).send_keys(cencet)
        sleep(2)
        self.loc_wait_ele(self.sousuoannniu).click()
        sleep(2)
        self.loc_ele(self.shuyou).click()
        sleep(2)
